home *** CD-ROM | disk | FTP | other *** search
- /*________________________________________________________________________________
- Sample main program to demonstrate Debug
- ________________________________________________________________________________*/
-
-
- static void
- InitMac()
- {
- UnloadScrap();
-
- InitGraf( &qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs( nil );
- InitCursor();
- MaxApplZone();
- }
-
-
- void
- main(void)
- {
- Handle theHandle;
-
- InitMac();
-
- DebugLeaks_Init();
-
- // start tracking leaks here
- // remember: code is not implemented; this is purely for example purposes
- #define kNumItemsToRemember 100UL
- DebugLeaks_StartSession( kNumItemsToRemember, "\pmain");
-
-
- // should result in an assert
- theHandle = nil;
- AssertHandleIsValid( theHandle, "\pmain");
-
- // should result in an assert
- // interesting unrelated fact: values between 0 and -32 work due to a bug in NewHandle
- theHandle = NewHandle( -100 );
-
- // should result in an assert
- DisposeHandle( theHandle );
-
-
- // will report any leaks (once the code is implemented)
- DebugLeaks_StopSession( );
- }
-
-
-
-
-
-